<!DOCTYPE html>
<html>
<head>
<title>房子详情</title>

<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<meta name="keywords" content="keyword1,keyword2,keyword3">
<meta name="description" content="this is my page">
<meta name="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<link href="../jsp/css/houseDetails.css" rel="stylesheet">
<link rel="stylesheet" href="./css/sm.min.css">
<link rel="stylesheet" href="./css/sm-extend.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.2/css/swiper.min.css">
<link href="../css/flickerplate.css" type="text/css" rel="stylesheet">
<script src="../js/jquery-2.1.1.js"></script>
<script src="../jsp/js/homeDetail.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="../js/min/modernizr-custom-v2.7.1.min.js"type="text/javascript"></script>
<script src="../js/min/flickerplate.min.js" type="text/javascript"></script>
<script src="../js/min/hammer-v2.0.3.min.js" type="text/javascript"></script>
<script src="./js/docs.js" type="text/javascript"></script>
<script src="./js/zepto.js" type="text/javascript"></script>
<script src="./js/sm.js" type="text/javascript"></script>
<script src="./js/sm-extend.js" type="text/javascript"></script>
<script src="./js/swiper.js" type="text/javascript"></script>
<script src="../js/swiper-init.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.2/js/swiper.min.js"></script>
<style>
body { touch-action: none; } 
  table.imagetable {
          font-family: verdana,arial,sans-serif;
          font-size:11px;
          color:#333333;
          border-width: 1px;
          border-color: #999999;
          border-collapse: collapse;
      }
      table.imagetable th {
          background:#b5cfd2 url('cell-blue.jpg');
          border-width: 1px;
          padding: 8px;
          border-style: solid;
          border-color: #999999;
      }
      table.imagetable td {
          background:#dcddc0 url('cell-grey.jpg');
          border-width: 1px;
          padding: 8px;
          border-style: solid;
          border-color: #999999;
      }

</style>
<script type="text/javascript">
window.$$=window.Zepto = Zepto;
(function ($) {
	  $.getUrlParam = function (name) {
	   var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
	   var r = window.location.search.substr(1).match(reg);
	   if (r != null) return unescape(r[2]); return null;
	  }
	 })(jQuery);
var houseId=null;
var grade= null;
var path = "/LanJuPublic";
$(function(){
// 	document.addEventListener('touchmove', this._preventDefault, { passive: false });
	    houseId= $.getUrlParam('houseId');
	    grade= $.getUrlParam('grade');
		HomeDetail.queryHomeDetailByHouseId(houseId);
	})
function shoucang(){
	$.ajax({
		type : "POST",
		dataType : 'json',
		url : "../user/isLogin.do",
		data : {
			"phone" : HomeDetail.getCookie("phone")
		},
		success : function(data) {
			if(data.success){
				if($("#cang").parent().hasClass("collect")){
					deleteCollect();
				}else{
					insertCollect();
				}
			}else{
				  $$.alert(data.msg, function(){
					  window.location.href="./login.html?url="+encodeURIComponent(window.location.href);
					});
			}
		}
	});
	
	
	}
	
	function insertCollect(){
		$.ajax({
			type : "POST",
			dataType : 'json',
			url : path+"/service/insertCollect.do",
			data : {
				"houseId": houseId,
				"phone" : HomeDetail.getCookie("phone")
			},
			success : function(data) {
				if(data.res == true){
					$$.toast("收藏成功");
					$("#cang").parent().addClass("collect");
					$("#cang").attr("src","../images/collection1.png");
				}else{
					$$.toast("收藏失败")
				}
			}
		})
	}
	
	function deleteCollect(){
		$.ajax({
			type : "POST",
			dataType : 'json',
			url : path+"/service/deleteCollect.do",
			data : {
				"houseId": houseId,
				"phone" : HomeDetail.getCookie("phone")
			},
			success : function(data) {
				if(data.res == true){
					$$.toast("取消收藏");
					$("#cang").parent().removeClass("collect");
					$("#cang").attr("src","../images/collection2.png");
				}else{
					$$.toast("取消失败")
				}
			}
		})
	}
	
function toYuYueKanFang(){
	 window.location.href = "./yuyueKanfang.html?houseId="+houseId
}

</script>
  <body>
   <header class="bar bar-nav">
    <a class="button button-link button-nav pull-left" href="#" data-transition='slide-out' onclick="HomeDetail.goback()">
      <span class="icon icon-left" ></span>
      返回
    </a>
    <h1 class="title">我的房子</h1>
  </header>
 
  <div style="height: 100%; background: #fff; overflow-y: scroll;padding-bottom:52px;">
   <div style="height:300px; margin-top: 45px;">
			<div class="flicker-example" style="height: 300px;">
				<ul id="imagesUl">
<!-- 					<li data-background="../images/flicker-1.jpg" style="height: 160px"></li> -->
<!-- 					<li data-background="../images/flicker-2.jpg" style="height: 160px"></li>  -->
<!-- 					<li data-background="../images/flicker-3.jpg" style="height: 160px"></li> -->
				</ul>
			</div>
		</div>

		<div class="imformation">
			<ul>
				<li><span style="font-size: 18px;font-weight: bold;" id="title"> </span></li>
				<li><span style="font-size: 18px;font-weight: bold;color:#FF9900;" id="price"> </span></li>
				<li id="flag"> </li>
				<li><img src="../images/postion.png" class="position">
					<span style="font-size: 14px;" id="jl"></span></li>
			</ul>
		</div>

		<div class="imformation1">
			<div class="imformation1_left imformation0_left">
				<ul>
					<li>面积：<label id="size"></label></li>
					<li>朝向：<label id="towards"></label></li>
					<li>户型：<label id="houseLayout"></label></li>
					<li>楼层：<label id="floor"></label></li>
					<li>电梯：<label id="elevator"></label></li>
<!-- 					<li>绿化：<label id="green"></label></li> -->
				</ul>
			</div>
		</div>


		<div class="imformation1" style="margin-top: 10px">
			<div class="imformation1_left" style="width: 100%; margin-left: 0;height: auto;padding-bottom: 10px;padding-left: 0;">
				<ul>
					<li><span class="title2">租约信息</span></li>
					<li><span>可入住时间：</span><label id="canStay"></label></li>
					<li><span>租约时长：</span><label id="leaseLength"></label></li>
					<li><span>押金方式：</span><label id="depositMethod"></label></li>
				</ul>
			</div>
		</div>
		
		<div class="imformation1" style="margin-top: 10px">
			<div class="imformation1_left" style="width: 100%; margin-left: 0;height: auto;padding-bottom: 10px;padding-left: 0;">
				<ul>
					<li><span class="title2">房源简介</span></li>
					<li style="height: auto;font-size: 14px;line-height: 30px;"><span id="houseDesc" ></span></li>
					<li style="height: auto;text-align:center;">
<!--  <table class="imagetable" style="width: 100%"> -->
<!--      <tr> -->
<!--          <th>设施名称</th> -->
<!--          <th>设施数量（件）</th> -->
<!--      </tr> -->
<!--     <tbody id="eq"> -->
<!--     </tbody> -->
     
<!--  </table> -->
<ul id="shebei" style=" padding: 10px">

</ul>
					</li>
				</ul>
			</div>
		</div>

		<div class="imformation1" style="margin-top: 10px">
			<div class="imformation1_left" style="width: 100%; margin-left: 0;padding-left: 0;">
				<ul>
					<li><span class="title2">蓝居管家</span>
						<label style="float: right;margin-right: 10px;"><a href="" id="lianxi" style="font-weight: 1;border: 1px solid #0894ec;border-radius: 100px;padding: 3px 10px;">联系TA</a></label></li>
					<li>
					<span style="max-width: 28%;height: 64px;" id="headImg"></span>
					<p style="padding-left: 15px;float: left;font-weight: 800;margin:0;" id="houldName"></p>
					<span style="float: right;width:70%;font-size:14px;line-height:24px;">
					<p style="float: left;margin:0;" id="personalMsg"></p></span>
					</li>
				</ul>
			</div>
		</div>
		
		<div class="imformation1" style="margin-top: 10px">
			<div class="imformation1_left" style="width: 100%; margin-left: 0;padding-left: 0;">
				<ul>
					<li><span class="title2">小区介绍</span></li>
					<li><span style="max-width: 25%;height: 64px;" id="communityImg"></span>
						<span style="float: right;width:70%;font-size: 14px;line-height: 24px;">
							<p style="line-height: 40px;">
								<span style="font-weight: bold;color: #000" id="communityName"></span>
								<p id="communityDesc"></p>
							<p>
					</p>
							</p></span></li>
				</ul>
			</div>
		</div>
		
		<div class="imformation1" style="margin-top: 10px">
			<div class="imformation1_left" style="width: 100%; margin-left: 0;padding-left: 0;">
				<ul>
					<li><span class="title2">周边交通</span></li>
					<li>
						<span style="float: left;width:99%;">
							<p style="padding-left: 5px;float: left;">
								<ul id="locationUl">
								</ul>
							</p></span></li>
				</ul>
			</div>
		</div>
		
		</div>
  </body>
  <script type="text/javascript">
  var nonce="";//生成签名的随机串
  var signature="";//签名
  var timestamp="";//时间戳
  var title="蓝居--定制租住生活";
  var desc="房屋出租托管、租房、除甲醛除异味、保洁家修戳我！";
  var sharLink="http://lanjushiye.com.cn/LanJuPublic/jsp/home.html";
  var imgUrl="http://lanjushiye.com.cn/LanJuPublic/images/lanju.jpg";
  $(document).ready(function(){  
	  var mySwiper = new Swiper('.swiper-container', {
		    speed: 400,
		    spaceBetween: 100
		});
	  $(".swiper-container").swiper(mySwiper);
	  var url = encodeURI(location.href.split('#')[0]);
	  $.ajax({
	         url: "../weixinImpl/getEncryptJsapiTicket.spring?rn="+(new Date().getTime()),
	         type: "POST",
	         data:{"url":url},
	         dataType: "json",
	         success: function(data){
	        	 if(data != null){
	        		 nonce=data.nonce;
		             signature=data.signature;
		             timestamp=data.timestamp;
		             loadWx();
	        	 }
	             
	          },
	          error:function(err){
	            console.log('异常');
	          }
	        });
});
  
  function loadWx(){
	  wx.config({
		    debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
		    appId: 'wxb3b7beee9190b2ef', // 必填，公众号的唯一标识wxd894029b9bdb4b67
		    timestamp: timestamp, // 必填，生成签名的时间戳
		    nonceStr: nonce, // 必填，生成签名的随机串
		    signature: signature,// 必填，签名
		    jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ'] // 必填，需要使用的JS接口列表
		});
	  wx.ready(function(){
		  //分享到朋友圈
		  wx.onMenuShareTimeline({
			    title: title, // 分享标题
			    link: sharLink, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
			    imgUrl: imgUrl, // 分享图标
			    desc: desc, // 分享描述
			    success: function () {
			    // 用户确认分享后执行的回调函数
				},
			cancel: function () {
			    // 用户取消分享后执行的回调函数
		    }
		});
		  //分享到朋友
		  wx.onMenuShareAppMessage({
			  title: title, // 分享标题
			  desc: desc, // 分享描述
			  link: sharLink, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
			  imgUrl: imgUrl, // 分享图标
			  type: 'link', // 分享类型,music、video或link，不填默认为link
			  dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
			  success: function () {
			  // 用户确认分享后执行的回调函数
			  },
			  cancel: function () {
			  // 用户取消分享后执行的回调函数
			  }
			  });
		  //分享到QQ
		  wx.onMenuShareQQ({
			  title: title, // 分享标题
			  desc: desc, // 分享描述
			  link: sharLink, // 分享链接
			  imgUrl: imgUrl, // 分享图标
			  success: function () {
			  // 用户确认分享后执行的回调函数
			  },
			  cancel: function () {
			  // 用户取消分享后执行的回调函数
			  }
			  });
	  });
	  
	  wx.error(function(res){
		
	  });
	  
}
  
  
  $(function(){
		window.$$=window.Zepto = Zepto;
		$('.flicker-example').flickerplate({
          auto_flick 				: true,
          auto_flick_delay 		: 8,
          flick_animation 		: 'transform-slide'
      });

	});
  </script>
</html>
